import sys

n = int(sys.argv[1])
count = 0
i = 0

fl = []
data = open("data.txt", "r")

for l in data:
    if count == 0:
        print(i)
        fl.append( open("data"+str(i)+".txt", "w"))
        i=i+1
    fl[i-1].write(l)
    count=count+1
    if count == n:
        count = 0

for j in range(i):
    fl[j].close()
